<!doctype html>
<html>
<head>
  <meta charset="utf-8">

  <!--[if IE]><![endif]-->

  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

  <title>{% block title %}{% if model_admin %}{{model_admin.get_display_name()}} | {% endif %}  {% if apps_dict %}{{apps_dict[model_grup]}} | {% endif %} {% endblock %} MoleCrud</title>
  <meta name="description" content="">
  <meta name="author" content="">

  <meta name="viewport" content="width=device-width; initial-scale=1.0">

  <link rel="stylesheet" href="{{ url_for('admin.static', filename='css/bootstrap.min.css') }}">
  <link rel="stylesheet" href="{{ url_for('admin.static', filename='css/bootstrap.min.responsive.css') }}">
  <link rel="stylesheet" href="{{ url_for('admin.static', filename='css/chosen.css') }}">
  <link rel="stylesheet" href="{{ url_for('admin.static', filename='css/datepicker.css') }}">
  <link rel="stylesheet" href="{{ url_for('admin.static', filename='css/admin.css') }}">

  <script src="{{ url_for('admin.static', filename='js/jquery.min.js') }}"></script>
  <script src="{{ url_for('admin.static', filename='js/bootstrap.min.js') }}"></script>
  <script src="{{ url_for('admin.static', filename='js/bootstrap-datepicker.js') }}"></script>
  <script src="{{ url_for('admin.static', filename='js/chosen.jquery.min.js') }}"></script>
  <script src="{{ url_for('admin.static', filename='js/ajax-chosen.min.js') }}"></script>
  <script src="{{ url_for('admin.static', filename='js/admin.js') }}"></script>

  {% block extra_script %}{% endblock %}
</head>

<body class="{% block body_class %}admin{% endblock %}">
  <!-- 顶部导航 开始 -->
  {% block top_nav %}
  <div class="navbar navbar-fixed-top">
    <div class="navbar-inner">
      <div class="container-fluid">
        <a class="brand" href="{{ url_for('admin.index') }}">Mole Crud <small>{{ branding }}</small></a>
		{% block main_menu %}
        <ul class="nav">
          <li class="active"><a href="{{ url_for('admin.index') }}">面板</a></li>
		  {% if apps %}
		  	{% for label, app_verb in apps %}
          <li{% if model_grup == label %} class="active"{% endif %}><a href="/admin/{{label}}">{{app_verb}}</a></li>
		  	{% endfor %}
		  {% endif %}
        </ul>
		{% endblock %}
		{% block custom_bar %}
        <form action="{{ url_for('auth.logout') }}" class="navbar-form pull-right" method="get">
          <button class="btn btn-danger">Logout</button>
        </form>
		{% endblock %}
      </div>
    </div>
  </div>
  {% endblock %}
  <!-- 顶部导航 结束 -->
	
  <div class="container-fluid">
    <div class="row-fluid">
    	
      <!-- 左侧导航 开始 -->
	  {% block left_nav %}
      <div class="span2">
        <div class="well sidebar-nav">
          {% block sidebar %}
			{% if get_app_nemus %} {# MoSys环境 #}
				{% for grup_verb, icon_class ,menus in get_app_nemus(model_grup) %}
				<h3>{{ grup_verb }}</h3>
				<ul id="nav" class="nav nav-list">
						{% for menu in menus %}
							<li{% if model_name== menu[3] %} class="active"{% endif %}><a href="{{ menu[1] }}">{{ menu[0]}}</a></li>
						{% endfor %}
				</ul>
				{% endfor %}
			{% else %}	{# Mole环境 #}
				<h3>导航</h3>
				<ul id="nav" class="nav nav-list">
						{% for iter_admin in model_admins %}
							{% if iter_admin.visible %}
							<li{% if model_name== iter_admin.get_admin_name() %} class="active"{% endif %}><a href="{{ url_for(iter_admin.get_url_name('index')) }}">{{ iter_admin.get_display_name()|fix_underscores }}</a></li>
							{% endif %}
						{% endfor %}
				</ul>
			{% endif %}
          {% endblock %}
        </div>
      </div>
	  {% endblock %}
	  <!-- 左侧导航 结束 -->

	  <!-- 主体 开始 -->
      <div class="span9">
        <div class="content">
        	
		  <!-- 导航信息开始 -->
		  {% block content_nav %}      
	          <div class="page-header">
	            <h2>{% block content_title %}{% endblock %} <small>{% block content_tagline %}{% endblock %}</small></h2>
	          </div>
			  {% block breadcrumb %}
			  <div>
	          <ul class="breadcrumb">
	            <li><a href="{{ url_for('admin.index') }}">面板</a></li>
	            {% block breadcrumbs %}{% endblock %}
	          </ul>
			  </div>
			  {% endblock %}
		  {% endblock %}
		  <!-- 导航信息结束 -->
		  
          {% for category, message in get_flashed_messages(with_categories=true) %}
            <div class="alert alert-block alert-{{ category }}">
              <a class="close" data-dismiss="alert" href="#">×</a>
              <p>{{ message }}</p>
            </div>
          {% endfor %}
		  
          {% block pre_content %}{% endblock %}
          {% block content %}{% endblock %}
        </div><!-- /content -->
      </div><!-- /span9 -->
	  <!-- 主体 结束 -->
	  
  </div> <!-- /row-fluid -->
</div><!-- /container-fluid -->

{% block bottom %}
<div style="padding-left:10px">
	<hr />
	<footer>
		<p>{% block footer %}Go <a href="/admin/">Admin</a>{% endblock %}</p>
	</footer>
</div>
{% endblock %}
</body>
</html>
